# added by yinchao, Thu July 04 10:49	2024

import sqlite3


conn = sqlite3.connect('music.sqlite')
cursor = conn.cursor()

cursor.execute(
    'INSERT INTO Track (title, plays) VALUES (?, ?)', ('yinchao', 1))
cursor.execute(
    'INSERT INTO Track (title, plays) VALUES (?, ?)', ('qiaoyan', 2))

# use the commit to Force the data to be written to the database file.
conn.commit()

cursor.execute('SELECT title, plays FROM Track')

print('Track:')
# after we execute select clause, the cursor is something that we can loop through in a for statement.
# It Does not reall all the data from the database.
for row in cursor:
    print(row)

cursor.execute('DELETE FROM Track WHERE plays < 100')
conn.commit()
conn.close()
